package thread2;

public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            while(!Thread.currentThread().isInterrupted()) {
                System.out.println("线程执行中");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        System.out.println(t.getState());
        t.start();
        Thread.sleep(4000);
        t.interrupt();  //线程内部出现阻塞（sleep）
        System.out.println(t.getState());
        t.notify();
        System.out.println(t.getState());
    }
}
